/***************************************************************************
 *   Copyright (C) 2010 by Oleg Goncharov  *
 *   $EMAIL$                           *                          
 *                                                                         *
 *   This file is part of ChessVision.                                     *
 *                                                                         *
 *   ChessVision is free software; you can redistribute it and/or modify   *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef POINTPYRMATCH_H
#define POINTPYRMATCH_H

#include "cpointdetector.h"

/**
Поиск шаблона ускорен за счет использования пирамидального преобразования.

	@author Goncharov Oleg <goncharovoi@yandex.ru>
*/

using namespace cv;

class CPointPyrMatch : public CPointDetector 
{
protected:
    Mat 	*d_sample;
    Mat 	*d_img;
    double 	*d_threshold;
    int 	d_maxlevel;

public:
    CPointPyrMatch(const Mat& sample, const Mat& test_img, double threshold = 0.7);
    ~CPointPyrMatch();

    bool DetectPoint(const Mat& img, Point2f& point);
    bool GetSampleSize(Size &size);

protected:
    void BuildPyr(Mat * d_sample);
    double RefineMatch(Point& point);
    void WCShiftAnalysis(const Mat& test_img);
};

#endif

